<?php

namespace app\index\model;

use Login_vali;
use think\Model;

class Login_model extends Model
{
    protected $table = 'htuser';
    function login(){
        $input = input();
        $vali = new \app\index\validate\Login_vali();
        if(!$vali->check($input)){
            throw new \Exception($vali->getError());
        };
        $login = $this ->getByLogin($input['login']);
        if(empty($login)){
            throw new \Exception('账号不存在');
        }
        if($login['password']!=$input['password']){
            throw new \Exception('密码错误');
        }
        return $login;
    }
}
